<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <!--准备好一个“容器”-->
    <div id="test"></div>

    <!--引入react核心库,必须在dom前面引入-->
    <script type="text/javascript" src="../js/react.development.js"></script>
    <!--引入react_dom，用于支持react操作DOM-->
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <!--引入babel，用于将jsx转为js-->
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <!--引入prop-types，用于对组件标签属性进行限制-->
    <script type="text/javascript" src="../js/prop-types.js"></script>
    <script type="text/babel">
        function Person(props){
            return(
                <div>
                    <ul>
                        <li>姓名：{props.name}</li>
                        <li>性别：{props.sex}</li>
                        <li>年龄：{props.age+1}</li>
                    </ul>
                </div>
            )

        }
        // 对标签属性进行类型限制、必要性的限制
        Person.propTypes = {
            name:PropTypes.string.isRequired, // 限制name为字符串且必传
            sex:PropTypes.string,
            age:PropTypes.number,
        }
        // 指定默认标签属性值
        Person.defaultProps = {
            sex:'不男不女',
            age:18
        }
        ReactDOM.render(<Person name="蕾蕾" sex="女" age={18}/>,document.getElementById('test'))
    </script>
</body>
</html>